package com.ezjie.ielts.module_word.adapter;

import java.util.ArrayList;
import java.util.List;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.ezjie.ielts.model.WordGroup;
import com.ezjie.ielts.module_word.ReviewContentFragment;

public class ReviewDetailAdapter extends FragmentStatePagerAdapter {

	private List<WordGroup> contents;
	private int isReview;

	public ReviewDetailAdapter(FragmentManager fm) {
		super(fm);
	}

	public void setTitles(List<WordGroup> contents, int isReview) {
		this.contents = contents;
		this.isReview = isReview;
	}

	@Override
	public Fragment getItem(int pos) {
		// TODO Auto-generated method stub
		return ReviewContentFragment.newInstance(pos, (ArrayList) contents, isReview);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return contents == null ? 0 : contents.size();
	}

	@Override
	public CharSequence getPageTitle(int position) {
		if (contents != null) {
			return contents.get(position).toString();
		}
		return super.getPageTitle(position);
	}

	@Override
	public int getItemPosition(Object object) {
		// TODO Auto-generated method stub
		return POSITION_NONE;
	}
}
